--行途为曜
local xingtuweiyao = fk.CreateSkill {
    name = "mcdh_xingtuweiyao",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

xingtuweiyao:addEffect(fk.EventPhaseStart,{
    can_trigger = function(self, event, target, player, data)
        return player == target and player:hasSkill(self) and player.phase == Player.Finish
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local canPublic = table.filter(target:getCardIds("h"), function(id)
            local card = Fk:getCardById(id)
            return card:getMark("@@mcdh_overt_card") == 0
        end)
        local num = math.min(2,#canPublic)
        if num == 0 then
            return false
        end
        local  cards = lib.askForPublicCard(room,player,player,num,num,self.name,true,"#mcdh_xingtuweiyao-public",".",true)
        if #cards ~= 0 then
            self.cost_data = cards
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local cards = self.cost_data
        for _, id in ipairs(cards) do
            local card = Fk:getCardById(id)
            room:setCardMark(card,"@@mcdh_overt_card" , 1)
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_xingtuweiyao"] = "行途为曜",
    [":mcdh_xingtuweiyao"] = "结束阶段，你可以明置两张牌(不足则全明置)",
    ["#mcdh_xingtuweiyao-public"] = "行途为曜:明置两张牌"

}

return xingtuweiyao